import type { Employee, AttendanceRecord, PayrollRecord } from '../types';

export const mockEmployees: Employee[] = [
  { id: 1, name: '王丽', email: 'wang.li@example.com', position: '高级前端开发工程师', department: '工程部', hireDate: '2022-03-15', salary: 25000, avatar: 'https://picsum.photos/id/1027/200/200', jobDescription: '使用React和TypeScript开发和维护面向用户的功能。' },
  { id: 2, name: '李强', email: 'li.qiang@example.com', position: '产品经理', department: '产品部', hireDate: '2021-07-20', salary: 28000, avatar: 'https://picsum.photos/id/1005/200/200', jobDescription: '定义产品愿景、策略和路线图。收集并确定产品和客户需求的优先级。' },
  { id: 3, name: '张伟', email: 'zhang.wei@example.com', position: 'UI/UX设计师', department: '设计部', hireDate: '2023-01-10', salary: 18000, avatar: 'https://picsum.photos/id/1011/200/200', jobDescription: '通过了解业务需求和用户反馈来创建以用户为中心的设计。创建用户流程、线框图、原型和模型。' },
  { id: 4, name: '刘敏', email: 'liu.min@example.com', position: '后端开发工程师', department: '工程部', hireDate: '2022-09-01', salary: 24000, avatar: 'https://picsum.photos/id/1012/200/200' },
  { id: 5, name: '陈勇', email: 'chen.yong@example.com', position: 'DevOps工程师', department: '工程部', hireDate: '2021-11-05', salary: 26000, avatar: 'https://picsum.photos/id/1013/200/200' },
  { id: 6, name: '赵静', email: 'zhao.jing@example.com', position: '市场专员', department: '市场部', hireDate: '2023-05-22', salary: 15000, avatar: 'https://picsum.photos/id/1014/200/200' },
];

const today = new Date();
const formatDate = (date: Date) => date.toISOString().split('T')[0];

export const mockAttendance: AttendanceRecord[] = [
  { id: 1, employeeId: 1, date: formatDate(today), status: 'Present', clockIn: '09:02', clockOut: '17:30' },
  { id: 2, employeeId: 2, date: formatDate(today), status: 'Present', clockIn: '08:55', clockOut: '17:45' },
  { id: 3, employeeId: 3, date: formatDate(today), status: 'Late', clockIn: '09:15', clockOut: '17:50' },
  { id: 4, employeeId: 4, date: formatDate(today), status: 'Present', clockIn: '08:45', clockOut: '17:33' },
  { id: 5, employeeId: 5, date: formatDate(today), status: 'Absent' },
  { id: 6, employeeId: 6, date: formatDate(today), status: 'Present', clockIn: '09:00', clockOut: '17:30' },
];

export const mockPayroll: PayrollRecord[] = mockEmployees.map(emp => {
  const bonus = emp.department === '工程部' ? 5000 : 2500;
  const deductions = 1200;
  const baseSalary = emp.salary;
  return {
    id: emp.id,
    employeeId: emp.id,
    payPeriod: '2024-07',
    baseSalary: parseFloat(baseSalary.toFixed(2)),
    bonus: bonus,
    deductions: deductions,
    netPay: parseFloat((baseSalary + bonus - deductions).toFixed(2)),
  };
});
